<%--
  Created by IntelliJ IDEA.
  User: 余先生
  Date: 2021/6/7
  Time: 11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <script>
        //跳转分页的方法
        function goPage(pageNum){
            //alert("我要显示第"+pageNum+"页");
            //1.设置当前的页码
            $("#setPage").val(pageNum);
            //2.提交搜索的表单  分页导航传递搜索条件
            $("#form1").submit();  //提交表单
        }

    </script>

</head>
<style>
    td{text-align: center;}
    th{text-align: center;}
    input{text-align: center;}
</style>
<body>
<div class="row clearfix">
    <div class="col-md-12 column">
        <table class="table table-hover table-striped">
          <thead>
          <tr align="center">
                <th>学号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th>地址</th>
                <th>状态</th>
                <th>生日</th>
                <th>年级编号</th>
                <th>年级名称</th>
                <th style="background-color: #c1edcf">操作</th>
            </tr>
          </thead>
        <tbody>
        <c:forEach items="${list}" var="s">
                <tr>
                    <td>${s.xh}</td>
                    <td>${s.name}</td>
                    <td>${s.age}</td>
                    <td>${s.sex}</td>
                    <td>${s.address}</td>
                    <td>${s.state}</td>
                    <td><fmt:formatDate value="${s.birthday}" pattern="yyyy-MM-dd"/></td>
                    <td>${s.gid}</td>
                    <td>${s.gname}</td>
                    <td style="background-color: #c1edcf">
                        <a style="color: red" href="JavaScript:if(confirm('你确定要删除当前学生的信息吗?')){location.href='/deleteStudent?xh=${s.xh}'}"><span class="glyphicon glyphicon-remove">删除</span></a> |
                        <a style="color: blue" href="/selectOneStu?xh=${s.xh}"><span class="glyphicon glyphicon-refresh">修改</span></a>
                    </td>
                </tr>
            </c:forEach>

        <nav class="navbar navbar-default" role="navigation">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="showStudentByPage">返回主页面</a>
                </div>
                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">根据条件查询<span class="sr-only"></span></a></li>
                    </ul>
                    <form name="form1" id="form1" action="${pageContext.request.contextPath}/queryStudentByCondtion" method="post"  class="navbar-form navbar-left">
                        <div class="form-row">
                        <div class="form-group col">
                            <label class="form-inline"><input type="text" name="name" id="name" value="${sc.name}" class="form-control" placeholder="请输入学生的姓名"></label>
                            <label class="form-inline"><input type="text" name="rAge"  id="rAge" value="${sc.rAge}" class="form-control" placeholder="请输入最小年龄范围"></label>
                            <label class="form-inline"><input type="text" name="gAge"  id="gAge" value="${sc.gAge}" class="form-control" placeholder="请输入最大年龄范围"></label>
                            <button type="submit" class="btn btn-success">查询</button>
                        </div>
                        </div>
                    </form>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>

        </tbody>
        </table>
    </div>
</div>
</body>
</html>
